﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AjaxPro;
using Vinamilk.BLL;
using HocLapTrinhWeb.DAL;

public partial class _Default : HocLapTrinhWeb.UI.PageBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        AjaxPro.Utility.RegisterTypeForAjax(typeof(_Default));
        var provinceBLL = new v_ProvinceBLL(getCurrentConnection());
        rpProvince.DataSource = provinceBLL.GetAllProvinceForGridView();
        rpProvince.DataBind();
        
    }
    [AjaxPro.AjaxMethod]
    public DataTable GetData(int ProvinceID)
    {
        var con = new Connection();
        if (con.CreateConnection(Global.cs_sqlserver, Global.Key, Global.ValidKey))
        {
            var VinamilkBll = new v_VinamilkBLL(con);
            var dt = VinamilkBll.GetAllVinamilkForGridView(0, 100,ProvinceID,1);
            return dt;
        }
        return null;
    }

    [AjaxPro.AjaxMethod]
    public DataTable SearchData(string txtSearch)
    {
        var con = new Connection();
        if (con.CreateConnection(Global.cs_sqlserver, Global.Key, Global.ValidKey))
        {
            var VinamilkBll = new v_VinamilkBLL(con);
            var dt = VinamilkBll.GetAllVinamilkForGridView(0, 100, txtSearch);
            return dt;
        }
        return null;
    }

}